import request from '@/utils/request'

/**
 * 获取库位列表
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getInventoryLocationList(params){
  return request({
    url: '/inventoryLocation/getInventoryLocationList',
    params,
  })
}

/**
 * 修改库位层级
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function saveInventoryLocationLevel(data){
  return request({
    url: '/inventoryLocation/saveInventoryLocationLevel',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 修改库位数据
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function saveInventoryLocationData(data){
  return request({
    url: '/inventoryLocation/saveInventoryLocationData',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 删除库位数据
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function delInventoryLocationData(data){
  return request({
    url: '/inventoryLocation/delInventoryLocationData',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 检测是否换绑
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function detectionSwitching(data){
  return request({
    url: '/inventoryLocation/detectionSwitching',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 根据商品id获取库位信息
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function getGoodsInventoryLocation(id){
  return request({
    url: `/inventoryLocation/getGoodsInventoryLocation/${id}`,
  })
}

/**
 * 根据库位基因链获取库位信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function getInventoryLocation(data){
  return request({
    url: '/inventoryLocation/getInventoryLocation',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 配置商品的库位信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export function dispositionInventoryLocationInfoData(data){
  return request({
    url: '/inventoryLocation/dispositionInventoryLocationInfoData',
    method: 'post',
    data,
    handleError: true,
  })
}
